<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            width: 100px;
            height: 100px;
            background-color: red;
            float: left;
            margin-right: 10px;
            text-align: center;
        }
        
        .box2 {
            width: 100px;
            height: 100px;
            background-color: blue;
            float: left;
            margin-right: 10px;
            text-align: center;
        }
        
        .box3 {
            width: 100px;
            height: 100px;
            background-color: pink;
            float: left;
            text-align: center;
        }
        
        body,
        html {
            width: 100%;
            height: 100%;
            overflow: hidden;
            margin: 0;
        }
    </style>
</head>

<body>
    <div class="box1" onclick="box1()">红色</div>
    <div class="box2" onclick="box2()">蓝色</div>
    <div class="box3" onclick="box3()">粉色</div>
</body>
<script>
    var body = document.body

    function box1() {
        body.style.backgroundColor = "red"
        body.style.color = "blue"
    }

    function box2() {
        body.style.backgroundColor = "blue"
        body.style.color = "pink"
    }

    function box3() {
        body.style.backgroundColor = "pink"
        body.style.color = "blue"

    }
</script>

</html>